package com.v.login;

import com.Dao.UserDao;
import com.entity.User;
import com.v.Index;
import com.v.movie.代码.*;
import javafx.scene.layout.Background;

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.sql.SQLException;
import java.util.List;

import javax.swing.*;
import javax.swing.border.LineBorder;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.JTableHeader;


/*
 * 用户主界面
 */
public class Interface extends JFrame{
	private static final long serialVersionUID = 7861837913935166280L;
	//将整个用户界面划分为左右两个面板
	private JPanel jp_Left;//左边的面板
	private JPanel jp_right;//右边的面板

	private JLabel jl_content;//最开始右边面板的内容
	//左边面板内容--开始

	private JButton jb_Refresh;//刷新按钮
	private JButton jb_signOut;//退出按钮

	private JLabel jl_Welcome;//欢迎您的标签

	private JPanel jp_Information;//点击欢迎你时得面板

	private JLabel jl_HotMovies;//热门电影的标签
	private JLabel jl_MyTicket;//我的影票标签
	private JLabel jl_FindMovie;//查找电影的标签
	private JLabel jl_science;//科幻的标签
	private JLabel jl_action;//动作的标签
	private JLabel jl_love;//爱情的标签

	//左边面板内容--结束

    //热门电影------
	private JPanel jp_HotMovies;//面板
	private JLabel HotMovies;//框架
	private JScrollPane scrollPane;// 滚动界面


	//右边面板==开始
	private JLabel jl_Information;//个人信息的标签
	private JLabel jl_UserName;//用户名标签
	private JLabel jl_Balance;//余额的标签
	private JLabel jl_Modify;//修改密码标签

	private JLabel jl_showUser;//显示用户名
	private JLabel jl_showBalance;//显示用户金额

	private JLabel jl_Original;//原密码
	private JTextField jtf_Original;//原密码输入框
	private JLabel jl_NewPassword;//新密码
	private JTextField jtf_NewPassword;//新密码输入框
	private JLabel jl_Determine;//确定
	private JLabel jl_Cancel;//取消的标签


	private JButton jb_Recharge;//点击充值的标签

	private Index index;



	//热门面板的内容
	private JLabel Film_album;// 电影专辑
	private JLabel Film_album1;// 电影专辑
	private JLabel Film_album2;// 电影专辑
	private JLabel Film_album3;// 电影专辑
	private JLabel Film_album4;// 电影专辑
	private JLabel Film_album5;// 电影专辑

	private JTextArea Film_introduction;// 电影简介
	private JTextArea Film_introduction1;// 电影简介
	private JTextArea Film_introduction2;// 电影简介
	private JTextArea Film_introduction3;// 电影简介
	private JTextArea Film_introduction4;// 电影简介
	private JTextArea Film_introduction5;// 电影简介

	// 右边面板内容--结束




	private Child1 child1;//全局变量
	private Child2 child2;//全局变量
	private Child3 child3;//全局变量
	private Child4 child4;//全局变量
	private Child5 child5;//全局变量
	private Child6 child6;//全局变量

	//右边面板==结束

	//显示一个小手
	private Cursor hand = new Cursor(Cursor.HAND_CURSOR);


	public int change = 0 ;//变量

	public int a = 0;//我的信息按钮判断：鼠标点击几次
	public int b = 0;//热门电影按钮判断：鼠标点击几次
	public int c = 0;//我的影票

	private Color light = new Color(128,128,128);

	private Color grey = new Color(200,221,242);


	private JPanel jp_dialog;
	public Interface(JTextField text) {

//		 String unametext=text.getText();


		//设置为边界布局
		setLayout(new BorderLayout());
		//将整个背景设置为白色背景
		this.getContentPane().setBackground(Color.white);



		//左边的面板
		jp_Left = new JPanel();
				jp_Left.setLayout(null);//设置为绝对布局
				jp_Left.setPreferredSize(new Dimension(130, 0));
				this.add(BorderLayout.WEST,jp_Left);//加入整个面板中

				//右边的面板
				jp_right = new JPanel() {

					//获得右边面板的背景图片
					private static final long serialVersionUID = -7832851738879922577L;
					@Override
					protected void paintComponent(Graphics g) {
						ImageIcon icon = new ImageIcon(Interface.class.getResource("背景图片-2.png"));
				g.drawImage(icon.getImage(), 0, 0, null);
			}


		};
		jp_right.setLayout(null);//设置为绝对布局
		jp_right.setOpaque(true);//将右边面板的背景设置为透明
		jp_right.setPreferredSize(new Dimension(870, 0));//设置边界布局的所站的大小
		jp_right.setBounds(130, 0, 870, 645);

		this.add(BorderLayout.EAST,jp_right);

		jl_content = new JLabel("欢迎您进入购票系统，尊敬的"+text.getText());
		jl_content.setFont(new Font("微软雅黑", Font.PLAIN, 40));
		jl_content.setForeground(Color.white);//设置字体颜色
		jl_content.setBounds(100, 100, 700, 100);
		jp_right.add(jl_content);


		//左边面板---------------------------------------------开始>

		//刷新按钮
		jb_Refresh = new JButton("刷新");
		jb_Refresh.setBounds(0, 0, 65, 30);
		jb_Refresh.setFont(new Font("微软雅黑", Font.PLAIN, 15));
		jb_Refresh.setForeground(Color.black);//设置字体颜色
		jb_Refresh.setCursor(hand);//放上去显示小手

		jp_Left.add(jb_Refresh);

		//退出按钮
		jb_signOut = new JButton("退出");
		jb_signOut.setBounds(66, 0, 65, 30);
		jb_signOut.setFont(new Font("微软雅黑", Font.PLAIN, 15));
		jb_signOut.setForeground(Color.black);//设置字体颜色
		jb_signOut.setCursor(hand);//放上去显示小手
		jb_signOut.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				System.exit(0);
			}
		});
		jp_Left.add(jb_signOut);

		//欢迎您的标签
		jl_Welcome = new JLabel("个人信息",JLabel.CENTER);//JLabel.CENTER:设置字体居中
		jl_Welcome.setCursor(hand);//放上去有小手
		jl_Welcome.setFont(new Font("楷体", Font.PLAIN, 20));//设置字体大小
		jl_Welcome.setOpaque(true);//设置标签背景为透明
		jl_Welcome.setForeground(Color.black);//设置字体颜色
		jl_Welcome.setBackground(new Color(200,221,242));//设置背景颜色
		jl_Welcome.setBounds(0, 33, 130, 30);//设置位置
		//鼠标监听事件
		jl_Welcome.addMouseListener(new MouseAdapter() {
			//鼠标放上去
			@Override
			public void mouseEntered(MouseEvent e) {

				jl_Welcome.setBackground(light);
			}
			//鼠标离开时
			@Override
			public void mouseExited(MouseEvent e) {

				jl_Welcome.setBackground(grey);
			}
			//鼠标点击时
			@Override
			public void mouseClicked(MouseEvent e) {

				a++;
				if (a==1){

					jl_Welcome.setBackground(grey);

					//调用个人信息面板
					getWelcome(text);
					//判断更新的是这个面板
					change = 1;
					//还原其他面板的点击次数
					b = 0;
					c = 0;
				}


			}

		});
		jp_Left.add(jl_Welcome);

		//热门电影
		jl_HotMovies = new JLabel("热门电影",JLabel.CENTER);
		jl_HotMovies.setCursor(hand);//放上去显示小手
		jl_HotMovies.setFont(new Font("楷体", Font.PLAIN, 20));//设置字体大小
		jl_HotMovies.setOpaque(true);//设置标签背景为透明
		jl_HotMovies.setForeground(Color.black);//设置字体颜色
		jl_HotMovies.setBackground(new Color(200,221,242));//设置背景颜色
		jl_HotMovies.setBounds(0, 66, 130, 30);//设置位置
		//鼠标监听事件
		jl_HotMovies.addMouseListener(new MouseAdapter() {
			//鼠标放上去
			@Override
			public void mouseEntered(MouseEvent e) {
				jl_HotMovies.setBackground(new Color(128,128,128));
			}
			//鼠标离开时
			@Override
			public void mouseExited(MouseEvent e) {
				jl_HotMovies.setBackground(new Color(200,221,242));
			}

			@Override
			public void mouseClicked(MouseEvent e) {
				 b++;
				 if (b == 1){
					 getDemo(text);
					 change = 2 ;
					 a = 0;
					 c = 0;
				 }


			}
		});
		jp_Left.add(jl_HotMovies);

		//我的影票
		jl_MyTicket = new JLabel("我的影票",JLabel.CENTER);
		jl_MyTicket.setCursor(hand);//放上去显示小手
		jl_MyTicket.setForeground(Color.black);//设置字体颜色
		jl_MyTicket.setFont(new Font("楷体", Font.PLAIN, 20));//设置字体大小
		jl_MyTicket.setOpaque(true);//设置标签背景为透明
		jl_MyTicket.setBackground(new Color(200,221,242));//设置背景颜色
		jl_MyTicket.setBounds(0, 99, 130, 30);//设置位置
		//鼠标监听事件
		jl_MyTicket.addMouseListener(new MouseAdapter() {
			//鼠标放上去
			@Override
			public void mouseEntered(MouseEvent e) {
				jl_MyTicket.setBackground(new Color(128,128,128));
			}
			//鼠标离开时
			@Override
			public void mouseExited(MouseEvent e) {
				jl_MyTicket.setBackground(new Color(200,221,242));
			}

			//鼠标点击标签时会触发
			public void mouseClicked(MouseEvent e) {
				c++;
				if (c == 1){
					getMyTicket(text);
					change = 3;
					a = 0;
					b = 0;

				}


			}

		});
		jp_Left.add(jl_MyTicket);

		//查找电影
		jl_FindMovie = new JLabel("查找电影",JLabel.CENTER);
		jl_FindMovie.setCursor(hand);//放上去显示小手
		jl_FindMovie.setForeground(Color.black);//设置字体颜色
		jl_FindMovie.setFont(new Font("楷体", Font.PLAIN, 20));//设置字体大小
		jl_FindMovie.setOpaque(true);//设置标签背景为透明
		jl_FindMovie.setBackground(new Color(200,221,242));//设置背景颜色
		jl_FindMovie.setBounds(0, 132, 130, 30);//设置位置
		//鼠标监听事件
		jl_FindMovie.addMouseListener(new MouseAdapter() {
			//鼠标放上去
			@Override
			public void mouseEntered(MouseEvent e) {
				jl_FindMovie.setBackground(new Color(128,128,128));
			}
			//鼠标离开时
			@Override
			public void mouseExited(MouseEvent e) {
				jl_FindMovie.setBackground(new Color(200,221,242));
			}

		});
		jp_Left.add(jl_FindMovie);

		//科幻的标签
		jl_science = new JLabel("科幻",JLabel.CENTER);
		jl_science.setCursor(hand);//放上去显示小手
		jl_science.setFont(new Font("楷体", Font.PLAIN, 20));//设置字体大小
		jl_science.setForeground(Color.black);//设置字体颜色
		jl_science.setOpaque(true);//设置标签背景为透明
		jl_science.setBackground(new Color(200,221,242));//设置背景颜色
		jl_science.setBounds(0, 165, 130, 30);//设置位置
		//鼠标监听事件
		jl_science.addMouseListener(new MouseAdapter() {
			//鼠标放上去
			@Override
			public void mouseEntered(MouseEvent e) {
				jl_science.setBackground(new Color(128,128,128));
			}
			//鼠标离开时
			@Override
			public void mouseExited(MouseEvent e) {
				jl_science.setBackground(new Color(200,221,242));
			}

		});
		jp_Left.add(jl_science);

		//动作的标签
		jl_action = new JLabel("动作",JLabel.CENTER);
		jl_action.setCursor(hand);//放上去显示小手
		jl_action.setFont(new Font("楷体", Font.PLAIN, 20));//设置字体大小
		jl_action.setForeground(Color.black);//设置字体颜色
		jl_action.setOpaque(true);//设置标签背景为透明
		jl_action.setBackground(new Color(200,221,242));//设置背景颜色
		jl_action.setBounds(0, 198, 130, 30);//设置位置
		//鼠标监听事件
		jl_action.addMouseListener(new MouseAdapter() {
			//鼠标放上去
			@Override
			public void mouseEntered(MouseEvent e) {
				jl_action.setBackground(new Color(128,128,128));
			}
			//鼠标离开时
			@Override
			public void mouseExited(MouseEvent e) {
				jl_action.setBackground(new Color(200,221,242));
			}

		});
		jp_Left.add(jl_action);

		//爱情的标签
		jl_love = new JLabel("爱情",JLabel.CENTER);
		jl_love.setCursor(hand);//放上去显示小手
		jl_love.setFont(new Font("楷体", Font.PLAIN, 20));//设置字体大小
		jl_love.setForeground(Color.black);//设置字体颜色
		jl_love.setOpaque(true);//设置标签背景为透明
		jl_love.setBackground(new Color(200,221,242));//设置背景颜色
		jl_love.setBounds(0, 231, 130, 30);//设置位置
		//鼠标监听事件
		jl_love.addMouseListener(new MouseAdapter() {
			//鼠标放上去
			@Override
			public void mouseEntered(MouseEvent e) {
				jl_love.setBackground(new Color(128,128,128));
			}
			//鼠标离开时
			@Override
			public void mouseExited(MouseEvent e) {
				jl_love.setBackground(new Color(200,221,242));
			}

		});
		jp_Left.add(jl_love);

		//
		//左边面板---------------------------------------------------->结束





		setSize(1000, 645);//大小
		setTitle("电影购票系统");//
		setLocationRelativeTo(null);//居中
		setResizable(false);//窗口不能调大小
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//关闭模式
		setVisible(true);//窗口可见
	}


	//个人信息面板
	public void getWelcome(JTextField  text) {
		User user=new User();
		UserDao userDao = new UserDao();
		List<User> users = userDao.queryUsersByuName(text.getText());
		for (User user1 : users) {
			System.out.println(users);
			user.setuName(user1.getuName());
			user.setBalance(user1.getBalance());
		}


		//判断上一个面板是那个面板
		if (change == 2){
			//移除上个面板
			remove(jp_HotMovies);
		}else if (change == 0){
			remove(jp_right);
		}else if (change == 3){
			remove(jp_dialog);
		}



		//创建一个新面板
		jp_Information = new JPanel() {

			//获得右边面板的背景图片
			private static final long serialVersionUID = -7832851738879922577L;
			@Override
			protected void paintComponent(Graphics g) {
				ImageIcon icon = new ImageIcon(Interface.class.getResource("背景图片-2.png"));
				g.drawImage(icon.getImage(), 0, 0, null);
			}


		};
		jp_Information.setLayout(null);//设置为绝对布局
		jp_Information.setOpaque(true);//将右边面板的背景设置为透明
		jp_Information.setBounds(130, 0, 870, 645);//设置边界布局的所站的大小
		this.add(BorderLayout.EAST,jp_Information);


		//右边面板=======================================>开始
		//个人信息标签
		jl_Information = new JLabel("您的个人信息如下：",JLabel.CENTER);
		jl_Information.setFont(new Font("楷体", Font.PLAIN, 25));//设置字体大小
		jl_Information.setForeground(Color.white);//设置字体颜色
		jl_Information.setBounds(200, 10, 250, 30);//设置位置
		jp_Information.add(jl_Information);


		//用户名标签
		jl_UserName = new JLabel("用户名：",JLabel.CENTER);
		jl_UserName.setFont(new Font("楷体", Font.PLAIN, 20));//设置字体大小
		jl_UserName.setForeground(Color.white);//设置字体颜色
		jl_UserName.setBounds(30, 50, 100, 30);//设置位置
		jp_Information.add(jl_UserName);

        jl_showUser=new JLabel(user.getuName());
		jl_showUser.setFont(new Font("楷体", Font.PLAIN, 20));//设置字体大小
		jl_showUser.setForeground(Color.white);//设置字体颜色
		jl_showUser.setBounds(115, 50, 100, 30);//设置位置
		jp_Information.add(jl_showUser);

		//余额
		jl_Balance = new JLabel("您的余额：",JLabel.CENTER);
		jl_Balance.setFont(new Font("楷体", Font.PLAIN, 20));//设置字体大小
		jl_Balance.setForeground(Color.white);//设置字体颜色
		jl_Balance.setBounds(310, 50, 100, 30);//设置位置
		jp_Information.add(jl_Balance);

		jl_showBalance=new JLabel(String.valueOf(user.getBalance()));
		jl_showBalance.setFont(new Font("楷体", Font.PLAIN, 20));//设置字体大小
		jl_showBalance.setForeground(Color.white);//设置字体颜色
		jl_showBalance.setBounds(405, 50, 100, 30);//设置位置
		jp_Information.add(jl_showBalance);


		//修改密码
		jl_Modify = new JLabel("修改密码",JLabel.CENTER);
		jl_Modify.setFont(new Font("楷体", Font.PLAIN, 20));//设置字体大小
		jl_Modify.setForeground(Color.white);//设置字体颜色
		jl_Modify.setBounds(30, 110, 100, 30);//设置位置
		jl_Modify.setOpaque(true);//设置标签背景为透明
		jl_Modify.setBackground(new Color(128,128,128));//设置背景颜色
		jp_Information.add(jl_Modify);

		//原密码
		jl_Original = new JLabel("原密码",JLabel.CENTER);
		jl_Original.setFont(new Font("楷体", Font.PLAIN, 20));//设置字体大小
		jl_Original.setForeground(Color.white);//设置字体颜色
		jl_Original.setBounds(30, 150, 70, 30);//设置位置
		jp_Information.add(jl_Original);

		//原密码输入框
		jtf_Original = new JTextField();
		jtf_Original.setBounds(30, 190, 130, 30);
		jtf_Original.setBorder(new LineBorder(Color.LIGHT_GRAY));
		jtf_Original.setFont(new Font("楷体", Font.PLAIN, 18));
		jtf_Original.setForeground(Color.black);
		jp_Information.add(jtf_Original);


		//新密码
		jl_NewPassword = new JLabel("新密码",JLabel.CENTER);
		jl_NewPassword.setFont(new Font("楷体", Font.PLAIN, 20));//设置字体大小
		jl_NewPassword.setForeground(Color.white);//设置字体颜色
		jl_NewPassword.setBounds(30, 260, 70, 30);//设置位置
		jp_Information.add(jl_NewPassword);

		//新密码输入框
		jtf_NewPassword = new JTextField();
		jtf_NewPassword.setBounds(30, 300, 130, 30);
		jtf_NewPassword.setBorder(new LineBorder(Color.LIGHT_GRAY));
		jtf_NewPassword.setFont(new Font("楷体", Font.PLAIN, 18));
		jtf_NewPassword.setForeground(Color.black);
		jp_Information.add(jtf_NewPassword);

		//确定的标签
		jl_Determine = new JLabel("确定",JLabel.CENTER);
		jl_Determine.setFont(new Font("楷体", Font.PLAIN, 20));//设置字体大小
		jl_Determine.setForeground(Color.white);//设置字体颜色
		jl_Determine.setOpaque(true);//设置标签背景为透明
		jl_Determine.setBackground(new Color(128,128,128));//设置背景颜色
		jl_Determine.setBounds(30, 360, 130, 30);//设置位置
		jl_Determine.setCursor(hand);
		jp_Information.add(jl_Determine);

		//取消的标签
		jl_Cancel = new JLabel("取消",JLabel.CENTER);
		jl_Cancel.setFont(new Font("楷体", Font.PLAIN, 20));//设置字体大小
		jl_Cancel.setForeground(Color.white);//设置字体颜色
		jl_Cancel.setOpaque(true);//设置标签背景为透明
		jl_Cancel.setBackground(new Color(128,128,128));//设置背景颜色
		jl_Cancel.setBounds(30, 400, 130, 30);//设置位置
		jl_Cancel.setCursor(hand);
		jp_Information.add(jl_Cancel);


		//充值按钮
		jb_Recharge = new JButton(new ImageIcon(Interface.class.getResource("充值按钮.png")));
		jb_Recharge.setBounds(310, 140, 130, 30);//设置位置
		jb_Recharge.setCursor(hand);
		jb_Recharge.setBorderPainted(false);
		//点击事件，进入子窗口
		jb_Recharge.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent e) {
				new Recharge(Interface.this);//进入子窗口

			}
		});
		jp_Information.add(jb_Recharge);

		//右边面板=========================================>结束
		//当面板内容发生改变时，需要重绘面板

		repaint();
	}


	//热门电影
	public void getDemo(JTextField text){

		//判断上一个面板是那个面板
		if (change == 1){
			//移除上个面板
			remove(jp_Information);
		}else if (change == 0){
			remove(jp_right);
		}else if (change == 3){
			remove(jp_dialog);
		}


		jp_HotMovies = new JPanel(){
			//获得右边面板的背景图片
			private static final long serialVersionUID = -7832851738879922577L;
			@Override
			protected void paintComponent(Graphics g) {
				ImageIcon icon = new ImageIcon(Interface.class.getResource("背景图片-2.png"));
				g.drawImage(icon.getImage(), 0, 0, null);
			}
		};
		jp_HotMovies.setLayout(null);// 设置为绝对布局
		jp_HotMovies.setOpaque(true);// 将右边面板的背景设置为透明
		jp_HotMovies.setPreferredSize(new Dimension(870, 0));// 设置边界布局的所站的大小
		jp_HotMovies.setBounds(130, 0, 870, 645);

		add(jp_HotMovies);

		scrollPane = new JScrollPane();
		jp_HotMovies.add(scrollPane);


		//add(BorderLayout.EAST,HotMovies);

		// 右边面板=======================================>开始
		Film_album = new JLabel(new ImageIcon(View_movie.class.getResource("荡寇风云.jpg")));
		Film_album.setBounds(60, 2, 220, 340);
		Film_album.setCursor(hand);// 放上去显示小手
		Film_album.addMouseListener(new MouseAdapter() {
			// 鼠标放上去
			@Override
			public void mouseEntered(MouseEvent e) {
				Film_album.setIcon(new ImageIcon(View_movie.class.getResource("荡寇风云-播放.jpg")));
			}

			// 鼠标离开时
			@Override
			public void mouseExited(MouseEvent e) {
				Film_album.setIcon(new ImageIcon(View_movie.class.getResource("荡寇风云.jpg")));
			}
			//鼠标点击标签时会触发
			public void mouseClicked(MouseEvent e) {
				//点击启动按钮的时候，创建一个子窗口
				//只要看到new关键字，就会产生一个新的对象，这个新的对象所有的内容初始化了的。
				//内部类获取外部类对象时使用类名.this
				child1 = new Child1(child1, true);
			}

		});
		jp_HotMovies.add(Film_album);

		Film_introduction = new JTextArea();
		Film_introduction.setBounds(60, 248, 220, 180);
		jp_HotMovies.add(Film_introduction);

		Film_album1 = new JLabel(new ImageIcon(View_movie.class.getResource("钢琴教师.jpg")));
		Film_album1.setBounds(312,2, 220, 340);
		Film_album1.setCursor(hand);// 放上去显示小手
		Film_album1.addMouseListener(new MouseAdapter() {
			// 鼠标放上去
			@Override
			public void mouseEntered(MouseEvent e) {
				Film_album1.setIcon(new ImageIcon(View_movie.class.getResource("钢琴教师-播放.jpg")));
			}

			// 鼠标离开时
			@Override
			public void mouseExited(MouseEvent e) {
				Film_album1.setIcon(new ImageIcon(View_movie.class.getResource("钢琴教师.jpg")));
			}
			//鼠标点击标签时会触发
			public void mouseClicked(MouseEvent e) {

				child2 = new Child2(child2, true);
			}
		});
		jp_HotMovies.add(Film_album1);

		Film_introduction1 = new JTextArea();
		Film_introduction1.setBounds(312,  248, 220, 180);
		jp_HotMovies.add(Film_introduction1);

		Film_album2 = new JLabel(new ImageIcon(View_movie.class.getResource("攀登者.jpg")));
		Film_album2.setBounds(554, 2, 220, 340);
		Film_album2.setCursor(hand);// 放上去显示小手
		Film_album2.addMouseListener(new MouseAdapter() {
			// 鼠标放上去
			@Override
			public void mouseEntered(MouseEvent e) {
				Film_album2.setIcon(new ImageIcon(View_movie.class.getResource("攀登者-播放.jpg")));
			}

			// 鼠标离开时
			@Override
			public void mouseExited(MouseEvent e) {
				Film_album2.setIcon(new ImageIcon(View_movie.class.getResource("攀登者.jpg")));
			}
			//鼠标点击标签时会触发
			public void mouseClicked(MouseEvent e) {

				child3 = new Child3(child3, true);
			}
		});
		jp_HotMovies.add(Film_album2);

		Film_introduction2 = new JTextArea();
		Film_introduction2.setBounds(554, 248, 220, 180);
		jp_HotMovies.add(Film_introduction2);

		Film_album3 = new JLabel(new ImageIcon(View_movie.class.getResource("审死官.jpg")));
		Film_album3.setBounds(60, 420, 220, 340);
		Film_album3.setCursor(hand);// 放上去显示小手
		Film_album3.addMouseListener(new MouseAdapter() {
			// 鼠标放上去
			@Override
			public void mouseEntered(MouseEvent e) {
				Film_album3.setIcon(new ImageIcon(View_movie.class.getResource("审死官-播放.jpg")));
			}

			// 鼠标离开时
			@Override
			public void mouseExited(MouseEvent e) {
				Film_album3.setIcon(new ImageIcon(View_movie.class.getResource("审死官.jpg")));
			}
			//鼠标点击标签时会触发
			public void mouseClicked(MouseEvent e) {

				child4 = new Child4(child4, true);
			}
		});
		jp_HotMovies.add(Film_album3);

		Film_introduction3 = new JTextArea();
		Film_introduction3.setBounds(60, 665, 220, 180);
		jp_HotMovies.add(Film_introduction3);

		Film_album4 = new JLabel(new ImageIcon(View_movie.class.getResource("叶问外传：张天志.jpg")));
		Film_album4.setBounds(312, 420, 220, 340);
		Film_album4.setCursor(hand);// 放上去显示小手
		Film_album4.addMouseListener(new MouseAdapter() {
			// 鼠标放上去
			@Override
			public void mouseEntered(MouseEvent e) {
				Film_album4.setIcon(new ImageIcon(View_movie.class.getResource("叶问外传：张天志-播放.jpg")));
			}

			// 鼠标离开时
			@Override
			public void mouseExited(MouseEvent e) {
				Film_album4.setIcon(new ImageIcon(View_movie.class.getResource("叶问外传：张天志.jpg")));
			}
			//鼠标点击标签时会触发
			public void mouseClicked(MouseEvent e) {

				child5 = new Child5(child5, true);
			}
		});
		jp_HotMovies.add(Film_album4);

		Film_introduction4 = new JTextArea();
		Film_introduction4.setBounds(312, 665, 220, 180);
		jp_HotMovies.add(Film_introduction4);

		Film_album5 = new JLabel(new ImageIcon(View_movie.class.getResource("云南虫谷.jpg")));
		Film_album5.setBounds(554, 420, 220, 340);
		Film_album5.setCursor(hand);// 放上去显示小手
		Film_album5.addMouseListener(new MouseAdapter() {
			// 鼠标放上去
			@Override
			public void mouseEntered(MouseEvent e) {
				Film_album5.setIcon(new ImageIcon(View_movie.class.getResource("云南虫谷-播放.jpg")));
			}

			// 鼠标离开时
			@Override
			public void mouseExited(MouseEvent e) {
				Film_album5.setIcon(new ImageIcon(View_movie.class.getResource("云南虫谷.jpg")));
			}
			//鼠标点击标签时会触发
			public void mouseClicked(MouseEvent e) {

				child6 = new Child6(child6, true);
			}
		});
		jp_HotMovies.add(Film_album5);

		Film_introduction5 = new JTextArea();
		Film_introduction5.setBounds(554, 665, 220, 180);
		jp_HotMovies.add(Film_introduction5);


		//scrollPane.setViewportView(jp_HotMovies);

		//jp_Information.add(scrollPane);
		//当面板内容发生改变时，需要重绘面板

		repaint();
	}


	//我的影票的北部面板
	private JPanel jp_MT_north;
	//我的影票的南部面板
	private JPanel jp_MT_south;

	//我的影票
	public void getMyTicket(JTextField  text){
		//判断上一个面板是那个面板
		if (change == 2){
			//移除面板
			remove(jp_HotMovies);
		}else if (change == 0){
			remove(jp_right);
		}else if (change == 1){
			remove(jp_Information);
		}

		jp_dialog = new JPanel();
		jp_dialog.setLayout(new BorderLayout());// 设置为边界布局
		//jp_dialog.setOpaque(true);// 将右边面板的背景设置为透明
		jp_dialog.setPreferredSize(new Dimension(870, 0));// 设置边界布局的所站的大小
		jp_dialog.setBounds(130, 0, 870, 645);

		add(jp_dialog);

		//北部面板
		jp_MT_north = new JPanel();
		jp_MT_north.setLayout(null);
		jp_MT_north.setBorder(new LineBorder(Color.RED, 2));
		jp_MT_north.setPreferredSize(new Dimension(0,340));
		jp_dialog.add(jp_MT_north,BorderLayout.NORTH);

		// 标签



		//字体标签
		JLabel typeface = new JLabel("你已评论");
		typeface.setFont(new Font("微软雅黑",Font.PLAIN,12));
		typeface.setBounds(260,120,60,20);
		typeface.setForeground(Color.black);
		jp_MT_north.add(typeface);
		//更改评论-按钮
		JButton Change_comments = new JButton("更改评论");
		Change_comments.setFont(new Font("微软雅黑",Font.PLAIN,12));
		Change_comments.setBounds(360,100,60,20);
		Change_comments.setForeground(Color.black);
		jp_MT_north.add(Change_comments);

		//发表-按钮
		JButton publish = new JButton("发表");
		publish.setFont(new Font("微软雅黑",Font.PLAIN,12));
		publish.setBounds(500,100,60,20);
		publish.setForeground(Color.black);
		jp_MT_north.add(publish);

		//文本框
		JTextField jT = new JTextField();
		jT.setFont(new Font("微软雅黑",Font.PLAIN,12));
		jT.setBounds(200,160,460,120);
		jT.setForeground(Color.black);
		jp_MT_north.add(jT);

		//退订
		JButton Unsubscribe = new JButton("退订");
		Unsubscribe.setFont(new Font("微软雅黑",Font.PLAIN,12));
		Unsubscribe.setBounds(660,280,60,20);
		Unsubscribe.setForeground(Color.black);
		jp_MT_north.add(Unsubscribe);


		//南部面板
		jp_MT_south = new JPanel();
		jp_MT_south.setLayout(null);
		jp_MT_south.setPreferredSize(new Dimension(0,305));
		jp_dialog.add(jp_MT_south,BorderLayout.SOUTH);

		// 表头（列名）
		Object[] columnNames = {"影院编号", "用户名", "影院名称", "影院地址", "场厅名字","电影名称 ","开始时间","价格","座位号"};

		// 表格所有行数据
		Object[][] rowData = {
				{"1", "那怒多", "长沙影院", "长沙", "一号大厅","攀登者","2020-7-3 12:00",100,35},
				{"2", "撒只给", "长沙影院", "长沙", "二号大厅","迪迦奥特曼","2020-7-6 12:00",100,26},
				{"3", "你要把我整神", "长沙影院", "长沙","三号大厅","葫芦娃","2020-7-2 12:00",100,16},
				{"4", "你过来呀！", "长沙影院", "长沙", "四号大厅","火影忍者","2020-7-8 12:00",100,6},
				{"5", "小灰灰霸主", "长沙影院", "长沙","五号大厅","七龙珠","2020-7-9 12:00",100,45}
		};

		// 创建一个表格，指定 所有行数据 和 表头
		JTable jt_showData = new JTable(rowData, columnNames);
		JTableHeader header = jt_showData.getTableHeader();
		header.setFont(new Font("微软雅黑",Font.PLAIN,12));
		header.setForeground(Color.MAGENTA);
		//设置单元格的样式
		DefaultTableCellRenderer d = new DefaultTableCellRenderer();
		//表格内容居中
		d.setHorizontalAlignment(JLabel.CENTER);
		jt_showData.setDefaultRenderer(Object.class, d);
		jt_showData.setRowHeight(30);//设置表格高度
		//设置表格字体样式
		jt_showData.setFont(new Font("楷体",Font.PLAIN,16));

		jt_showData.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);


		JPanel Lower_part = new JPanel();
		Lower_part.setBorder(new LineBorder(new Color(248,248,255),2));
		Lower_part.setBounds(0,310,870,308);

		// 把 表头 添加到容器顶部（使用普通的中间容器添加表格时，表头 和 内容 需要分开添加）
		Lower_part.add(jt_showData.getTableHeader(),BorderLayout.NORTH);

		// 把 表格内容 添加到容器中心
		Lower_part.add(jt_showData, BorderLayout.CENTER);

		jp_MT_south.add(Lower_part);




		repaint();
	}



	public static void main(String[] args) {
//		new Interface();
	}

}
